package chapter3.eg4;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;

public class ByteBufApp {

  @Test
  public void testPooled() throws InterruptedException {
    PooledByteBufAllocator allocator = PooledByteBufAllocator.DEFAULT;
    ByteBuf buffer = allocator.buffer(2<<15 - 1);
    buffer.release();
    buffer = allocator.buffer(2<<15 + 1);
  }

  @Test
  public void sum() {
    int sum = 0;
    for (int i = 0; i <= 11; i++) {
      sum += 1 << i;
    }

    // 1 + 2 + 4 + 8 + 16 + 32 + 。。。 + 2048
    System.out.println(sum);
  }
}
